/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Anali
 */
@Entity
@Table(name = "rolmodulo")
@NamedQueries({
    @NamedQuery(name = "Rolmodulo.findAll", query = "SELECT r FROM Rolmodulo r"),
    @NamedQuery(name = "Rolmodulo.findByIdRolModulo", query = "SELECT r FROM Rolmodulo r WHERE r.idRolModulo = :idRolModulo")})
public class Rolmodulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idRolModulo")
    private Integer idRolModulo;
    @JoinColumn(name = "idModulo", referencedColumnName = "idModulo")
    @ManyToOne(optional = false)
    private Modulo modulo;
    @JoinColumn(name = "idRol", referencedColumnName = "idRol")
    @ManyToOne(optional = false)
    private Rol rol;

    public Rolmodulo() {
    }

    public Rolmodulo(Integer idRolModulo) {
        this.idRolModulo = idRolModulo;
    }

    public Integer getIdRolModulo() {
        return idRolModulo;
    }

    public void setIdRolModulo(Integer idRolModulo) {
        this.idRolModulo = idRolModulo;
    }

    public Modulo getModulo() {
        return modulo;
    }

    public void setModulo(Modulo modulo) {
        this.modulo = modulo;
    }

    public Rol getRol() {
        return rol;
    }

    public void setRol(Rol rol) {
        this.rol = rol;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRolModulo != null ? idRolModulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rolmodulo)) {
            return false;
        }
        Rolmodulo other = (Rolmodulo) object;
        if ((this.idRolModulo == null && other.idRolModulo != null) || (this.idRolModulo != null && !this.idRolModulo.equals(other.idRolModulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Rolmodulo[idRolModulo=" + idRolModulo + "]";
    }

}
